<?php

namespace App\Http\Controllers\Home;

use Illuminate\Http\Request;

use Hash;
use DB;
use App\Http\Requests;
use App\Http\Controllers\Controller;

class GoodsController extends Controller
{
    //显示登录页面
    public function show($id)
    {
    	
    	$goods = DB::table('store_goods')
    			->join('store_category','store_category.id','=','store_goods.pid')
    			->select('store_goods.*','store_category.category_name')
    			->where('store_goods.id',$id)
    			->first();
    	//测试设置session
    	session(['uid' => 'admin']);
    	//获取当前分类商品
    	$categoods = DB::table('store_goods')->where('pid',$goods->pid)->orderBy('id','desc')->limit(4)->get();
    	return view('home.goods.detail',['goods'=>$goods,'categoods'=>$categoods]);
	}
	
}
